<?php
/* 管理后台控制器的父级控制器，做用户验证，初始化用户信息等操作 */

namespace App\Http\Controllers;

class HomeController extends Controller
{
    //定义内部变量，存放登录用户信息，供子类共享
    protected $user_id;     //用户id
    protected $ID_type = [1 => '居民身份证', 2 => '港澳台通行证', 3 => '护照'];

    public function __construct($except = '') {
        parent::__construct();
        //验证用户身份
        //$this->middleware('access', ['except' => $except]);

        $this->middleware(function ($request, $next) {
            //登录用户信息初始化
            $this->user_id = isset($request->user_id) ? $request->user_id : '';
            return $next($request);
        });
        
    }

}
